import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
import { userInfo } from '@/api/user.js'
export default new Vuex.Store({
  state: {
    userInfo:{}
  },
  getters: {
  },
  mutations: {
    // 设置个人信息
    setUserInfo(state,payload){
      state.userInfo=payload
    }
  },
  actions: {
    // 获取个人信息
    getUserInfo({commit},payload){
      userInfo().then(res=>{
        commit('setUserInfo',res.data)
      })
    }
  },
  modules: {
  }
})
